<template>
  <div>
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/Home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>人员管理</el-breadcrumb-item>
      <el-breadcrumb-item>证书管理</el-breadcrumb-item>
    </el-breadcrumb>

    <!-- 卡片视图区域 -->
    <el-card>
      <el-row :gutter="20">
        <el-col :span="7">
          <el-input placeholder="请输入姓名" v-model="queryInfo.name">
            <el-select v-model="queryInfo.ndtname" slot="prepend" placeholder="请选择" class="input-with-select" style="width:90px;">
              <!-- <el-option label="请选择" value=""></el-option> -->
              <el-option label="PT" value="PT"></el-option>
              <el-option label="UT" value="UT"></el-option>
              <el-option label="RT" value="RT"></el-option>
              <el-option label="ET" value="ET"></el-option>
              <el-option label="VT" value="VT"></el-option>
              <el-option label="MT" value="MT"></el-option>
              <el-option label="PAUT" value="PAUT"></el-option>
              <el-option label="LT" value="LT"></el-option>
            </el-select>
            <el-button slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </el-col>
        <el-col :span="3">
          <el-button type="primary">添加证书</el-button>
        </el-col>
      </el-row>

      <!-- 证书列表表格区域 -->
      <el-table :data="ndt_list" stripe style="width: 100%" border>
        <el-table-column label="序号" width="80" type="index"></el-table-column>
        <el-table-column prop="member.m_realname" label="姓名" width="200"> </el-table-column>
        <el-table-column prop="name" label="证书" width="100"> </el-table-column>
        <el-table-column prop="level" label="等级" width="100"> </el-table-column>
        <el-table-column prop="organ" label="机构"> </el-table-column>
        <el-table-column prop="empire_date" label="有效期"> </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button type="primary" icon="el-icon-edit" size="mini"></el-button>
            <el-button type="danger" icon="el-icon-delete" size="mini"></el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页区域 -->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="queryInfo.pagenum"
        :page-sizes="[2, 4, 6]"
        :page-size="queryInfo.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryInfo: {
        name: '',
        pagesize: 2,
        pagenum: 1,
        ndtname: ''
      },
      total: 10,
      ndt_list: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    async getList() {
      const { data: res } = await this.$http.get('license/ndtlist')
      if (res.meta.status !== 200) {
        return this.$message.error('获取证书列表失败')
      }
      this.ndt_list = res.data
    },
    handleSizeChange(newSize) {
      this.queryInfo.pagesize = newSize
      this.getList()
    },
    handleCurrentChange(newPage) {
      this.queryInfo.pagenum = newPage
      this.getList()
    }
  }
}
</script>

<style lang="less" scoped></style>
